Suppress Dremio Cloud 400 "already exists" in folder creation#318
Merged
Conversation
Dremio Cloud returns HTTP 400 with "An object already exists with that name" when a folder already exists, whereas Software returns HTTP 409. The Software case is already swallowed by the DremioAlreadyExistsException branch in _create_folders, but the Cloud case fell into the DremioBadRequestException branch and crashed dbt run. Normalize at the API boundary: _check_error reroutes 400 + the "already exists" message to DremioAlreadyExistsException. Existing handlers in _create_folders and _create_space catch both cases uniformly with no changes. DX-117811 / dbt-dremio#313 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5fe99b8 to
ee81ba2
Compare
fernando-dremio
approved these changes
May 15, 2026
bcmeireles
approved these changes
May 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Dremio Cloud returns HTTP 400 with
"An object already exists with that name"when a folder already exists during_create_folders, whereas Dremio Software returns HTTP 409. The Software 409 case is already swallowed by the existingDremioAlreadyExistsExceptionhandler in_create_folders, but the Cloud 400 case fell into theDremioBadRequestExceptionbranch and crasheddbt run.This PR normalizes at the API boundary:
_check_errorindbt/adapters/dremio/api/rest/utils.pynow reroutes 400 +"An object already exists with that name"toDremioAlreadyExistsException. The existing handlers in_create_foldersand_create_spacecatch both Cloud and Software cases uniformly with no changes.Why at this layer
connections.pystays unchanged — no scope creep.Test Plan
pytest tests/unit/— 8/8 tests passtests/unit/test_rest_utils.py(new) —_check_errormapping:DremioAlreadyExistsException✓DremioBadRequestException(regression guard) ✓DremioAlreadyExistsException(regression guard) ✓tests/unit/test_connection.py::TestCreateFolders::test_create_folders_swallows_already_exists(new) — end-to-end:_create_foldersswallows the rerouted exception, loop continues, method returns normally.black+flake8clean on touched files.Risk
The match string
"An object already exists with that name"is a literal substring against the response body. If Cloud ever changes the wording, the fallback path raisesDremioBadRequestExceptionanddbt runcrashes (current baseline). Acceptable trade-off; we can add another substring if needed.References
🤖 Generated with Claude Code